﻿<%@ Page Language="C#" MasterPageFile="~/JOINT/MstPage_JOINT.master" AutoEventWireup="true" CodeFile="frmJ_StaffLangAbilityInput.aspx.cs" Inherits="JOINT_frmJ_StaffLangAbilityInput" Title="Untitled Page" Culture="ja-JP" uiCulture="ja" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
 語学力情報登録</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <link href="../Style/JsStyle.css" rel="stylesheet" type="text/css" />
  
<script type="text/javascript" src="../Js/jquery.min.js"></script>
<script type="text/javascript" src="../Js/jquery.alphanumeric.pack.js"></script>
<script type="text/javascript" src="../Js/jquery.maskedinput.js"></script>
<script src="../js/Validation.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">

    function validatDateNow(oSrc, args)// kiem tra ngay thang hien tai.
    {
        args.IsValid = checkYearOld(args.Value, getNowDate(new Date()), 0, "<");


    }
    
    function validatDateNowCheck()// kiem tra ngay thang hien tai.
    {
        var check = '';
        var dateinput = document.getElementById('ctl00_ContentPlaceHolder1_txt検定受験日').value;
        var year_input = dateinput.substr(0, 4);
        var day_input1 = dateinput.substr(8, 2);
        var month_input = dateinput.substr(5, 2);
        var currentTime = new Date();
        var year_now = currentTime.getFullYear();
        var month_now = currentTime.getMonth() + 1;
        var day_now1 = currentTime.getDate();

        if (year_input == year_now) {
            if (month_input == month_now) {
                if (day_input1 <= day_now1) {
                    check = 'true';
                }
                else {
                    check = 'false';
                }

            }
            else if (month_input < month_now) {
                   check = 'true';
            }
            else {
                  check = 'false';
            }

        }
        else if (year_input < year_now) {
              check = 'true';
        }
        else
              check = 'false';
        return check;


    }


    function CheckDiem(oSrc, args)// kiem tra de trong thi bat loi, nhung nhap ma nhap sai se bat loi.
    {
        var diem = args.Value

        var regex = /^(\d+|\-\d){1,}$/;
        if (diem != "") {
            if (regex.test(diem)) {
                args.IsValid = true;
            }
            else {
                args.IsValid = false;
            }
        }



    }
    
 function mysplit(date) {
    var mydate = document.getElementById(date).value;
    if(mydate.length == 8)
    {
        var year = mydate.substr(0, 4);
        var month = mydate.substr(4, 2);
        var day = mydate.substr(6, 2);
        document.getElementById(date).value = year + '/' + month + '/' + day;
    }
    else
    {
       document.getElementById(date).value = ""; 
    }
}

function mysplitFocus(date) {
    var myvalue = document.getElementById(date).value;
    if(myvalue.length == 10)
    {
        var arr= myvalue.split("/");
        //alert(arr[0]+arr[1]+arr[2]);
        var lengthdate = arr[0]+arr[1]+arr[2];
       document.getElementById(date).value = lengthdate ;
    }
   
}   
    
    function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) || (key == 13) ) 
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}
    
    
//     var arr = ["ctl00_ContentPlaceHolder1_validate_ddl語学名",
//                "ctl00_ContentPlaceHolder1_validate_txtレベル",
//                "ctl00_ContentPlaceHolder1_validate_ddl検定種別",
//                "ctl00_ContentPlaceHolder1_validate_txt検定受験日",
//                "ctl00_ContentPlaceHolder1_validate_regular_txt検定受験日",
//                "ctl00_ContentPlaceHolder1_validateday_Custom",
//                "ctl00_ContentPlaceHolder1_validate_txtスコスListening_Custom",
//                "ctl00_ContentPlaceHolder1_validate_txtスコスwriting_Custom",
//                "ctl00_ContentPlaceHolder1_validate_txtスコスreading",
//                "ctl00_ContentPlaceHolder1_CustomValidator1"];
//     var number = 0;
//    $(document).ready(function() {
//        if (number == 0) {
//            for (i = 0; i < arr.length; i++) {
//                ValidatorEnable(document.getElementById(arr[i]), false);
//            }
//        }
//        
//   $('.btn').bind('click', function() {
//            number = 1;
//            setTimeout(function() {
//                for (j = 0; j < arr.length; j++) {
//                    ValidatorEnable(document.getElementById(arr[j]), true);
//                }
//            }, 100);
//        });
//        
//        
//    var $inp = $('.Font_textbox'); //var $inp = $('input:text');
//        $inp.bind('keydown', function(e) {
//            var key = e.which;
//            if (key == 13 && !e.shiftKey) {
//                e.preventDefault();

//                if ($(this).val() == "____/__/__")
//                    $(this).val("");
//                    
//                var nxtIdx = $inp.index(this) + 1;
//                setTimeout('funcNextBox(' + nxtIdx + ')', 100);
//            }
//        });
//    });
//    
//     function funcNextBox(nxtIdx) {
//        if (nxtIdx == 7) {
//            $('#ctl00_ContentPlaceHolder1_btn_登録').focus();
//        }
//        else {
//            $(".Font_textbox:eq(" + nxtIdx + ")").focus(); //$(":input:text:eq(" + nxtIdx + ")").focus();
//        }
//    }     
//     $(document).keypress(function() {
//        CheckValidSubmit();
//    });

//    $(document).mousedown(function() {
//        CheckValidSubmit();
//    })
//    function CheckValidSubmit() {
//        var 語学名 = $('#ctl00_ContentPlaceHolder1_ddl語学名').val();
//        var レベル = $('#ctl00_ContentPlaceHolder1_txtレベル').val();
//        var 検定種別 = $('#ctl00_ContentPlaceHolder1_ddl検定種別').val();
//        var 検定受験日 = $('#ctl00_ContentPlaceHolder1_txt検定受験日').val();
//        var regex = /^((((19|20)(([02468][048])|([13579][26]))[- /.]02[- /.]29))|((20[0-9][0-9])|(19[0-9][0-9]))[- /.]((((0[1-9])|(1[0-2]))[-  /.]((0[1-9])|(1\d)|(2[0-8])))|((((0[13578])|(1[02]))[- /.]31)|(((0[1,3-9])|(1[0-2]))[- /.](29|30)))))$/;
//        if(語学名 != "-1" && レベル != "" && 検定種別 != "-1" && 検定受験日 != "" && regex.test(検定受験日) && validatDateNowCheck() != 'false')
//        {
//            $('#ctl00_ContentPlaceHolder1_TextBox1').val('submit_form');
//        }
//        else
//        {
//            $('#ctl00_ContentPlaceHolder1_TextBox1').val('');
//        }
//    }


$(document).ready(function() {
     registerEnterEvent("enter", "<%= btn_登録.ClientID %>", 7);
     registerControlToValidation("validation");
     formatDate("css_text_calender", "/");
 });    						
						


</script>
<style type="text/css">
    .imemode_active
    {
    	ime-mode: active;
    }
</style>



<div  class="maindiv1">
  <div class="Header1">
            ＊: 必須.</div>
              <div class="NoteStyle">※下記の情報があれば、必須項目を入力してください。なければ、次ボタンを押してください。</div>

        <div>&nbsp;</div>
        
        
        
        <div class="detail-admin-row">
            <span class="detail-admin-label">語学名 :</span>
            <asp:DropDownList ID="ddl語学名" runat="server" Width="164px" ValidationGroup="detailForm" CssClass="Font_textbox validation enter">
            <asp:ListItem Value="-1" selected="true">[選択]</asp:ListItem>
            </asp:DropDownList><span class="required-field"> *</span>
        
        <asp:RequiredFieldValidator 
            runat="server" 
            ID="validate_ddl語学名"
            ControlToValidate="ddl語学名"
            Display="None"
            SetFocusOnError="false"
            InitialValue ="-1"
            ErrorMessage="" >
        </asp:RequiredFieldValidator> 
       
       <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender1"
       
        TargetControlID="validate_ddl語学名" HighlightCssClass = "invalid" Width="260px"
        CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png" /> 
        
        
        
         <asp:CustomValidator runat="server" ID="CustomValidator1"   OnServerValidate="CustomValidate語学名"
      ErrorMessage="" ControlToValidate="ddl語学名" Display="None"    SetFocusOnError="false" >
        </asp:CustomValidator>
          <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender8"
        TargetControlID="CustomValidator1" HighlightCssClass = "invalid" Width="260px"
        CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png" />
        
        
        
        
        
        
        
        </div>
        



        <div class="detail-admin-row">
            <span class="detail-admin-label">レベル :</span>
            <asp:TextBox ID="txtレベル" runat="server" Width="159px" ValidationGroup="detailForm" CssClass="Font_textbox imemode_active validation enter"></asp:TextBox><span class="required-field"> *</span>
       
       
       
       <asp:RequiredFieldValidator 
            runat="server" 
            ID="validate_txtレベル"
            ControlToValidate="txtレベル"
            Display="None"
            SetFocusOnError="false"
            ErrorMessage="" >
        </asp:RequiredFieldValidator> 
       
       <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender2"
       
        TargetControlID="validate_txtレベル" HighlightCssClass = "invalid" Width="260px"
        CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png" /> 
       
       
       </div>
       <div class="detail-admin-row">
            <span class="detail-admin-label">検定種別 :</span>
            <asp:DropDownList ID="ddl検定種別" runat="server" Width="164px" ValidationGroup="detailForm" CssClass="Font_textbox validation enter">
            <asp:ListItem Value="-1" selected="true">[選択]</asp:ListItem>
            </asp:DropDownList><span class="required-field"> *</span>
        
        
         <asp:RequiredFieldValidator 
            runat="server" 
            ID="validate_ddl検定種別"
            ControlToValidate="ddl検定種別"
            Display="None"
            SetFocusOnError="false"
            InitialValue ="-1"
            ErrorMessage="" >
        </asp:RequiredFieldValidator> 
       
       <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender3"
       
        TargetControlID="validate_ddl検定種別" HighlightCssClass = "invalid" Width="260px"
        CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png" /> 
        
        
        
        
        
        
        
        
        </div>
       <div class="detail-admin-row">
            <span class="detail-admin-label">検定受験日 :</span>
            <asp:TextBox ID="txt検定受験日" runat="server" ValidationGroup="detailForm" MaxLength ="8"  onkeypress="return InputNumberKeys(this, event);" CssClass="Font_textbox validation enter css_text_calender"  style="ime-mode:disabled"
               Width="159px"></asp:TextBox><span class="required-field"> 
                    <asp:ImageButton ID="imb検定受験日" runat="server" Height="19px"  CssClass="cal_Img"  ImageUrl="~/Images/calendar.jpg"/></span><span class="required-field"> *</span>
           <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="imb検定受験日"  Format="yyyy/MM/dd"
               TargetControlID="txt検定受験日">
           </ajaxToolkit:CalendarExtender>
                   
                   
             <asp:RequiredFieldValidator 
            runat="server" 
            ID="validate_txt検定受験日"
            ControlToValidate="txt検定受験日"
            Display="None"
            SetFocusOnError="false"
            ErrorMessage="" >
        </asp:RequiredFieldValidator> 
       
       <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender4"
       
        TargetControlID="validate_txt検定受験日" HighlightCssClass = "invalid" Width="260px"
        CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png" />        
          
          
        <%--<asp:RegularExpressionValidator runat="server" ID ="validate_regular_txt検定受験日" ControlToValidate="txt検定受験日"  ValidationExpression="^((((19|20)(([02468][048])|([13579][26]))[- /.]02[- /.]29))|((20[0-9][0-9])|(19[0-9][0-9]))[- /.]((((0[1-9])|(1[0-2]))[-  /.]((0[1-9])|(1\d)|(2[0-8])))|((((0[13578])|(1[02]))[- /.]31)|(((0[1,3-9])|(1[0-2]))[- /.](29|30)))))$" ErrorMessage="" Display="none" SetFocusOnError="false" ></asp:RegularExpressionValidator>--%>
            
             <asp:CustomValidator runat="server" ID="CustomValidator2"  ClientValidationFunction="isDate"
                ErrorMessage="" ControlToValidate="txt検定受験日" Display="None"    SetFocusOnError="false" >
             </asp:CustomValidator>
            
            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorRegular1"
            TargetControlID="CustomValidator2" HighlightCssClass = "invalid" Width="260px"
            CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png" />           
                   
                   
        
         <asp:CustomValidator runat="server" ID="validateday_Custom"  ClientValidationFunction="validatDateNow"
      ErrorMessage="" ControlToValidate="txt検定受験日" Display="None"    SetFocusOnError="false" >
        </asp:CustomValidator>
          <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCustom1"
        TargetControlID="validateday_Custom" HighlightCssClass = "invalid" Width="260px"
        CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png" />
        
        
        
       
                   
                   
                   
                   </div>
       <div class="detail-admin-row">
            <span class="detail-admin-label">スコス(Listening) :</span>
            <asp:TextBox ID="txtスコスListening" runat="server" Width="159px" ValidationGroup="detailForm" CssClass="Font_textbox validation enter" MaxLength="8"></asp:TextBox><span class="required-field"> </span>
       
       
       
        <asp:CustomValidator runat="server" ID="validate_txtスコスListening_Custom"  ClientValidationFunction="CheckDiem"
      ErrorMessage="" ControlToValidate="txtスコスListening" Display="None"    SetFocusOnError="false" >
        </asp:CustomValidator>
          <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender5"
        TargetControlID="validate_txtスコスListening_Custom" HighlightCssClass = "invalid" Width="260px"
        CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png" />
        
        <ajaxToolkit:FilteredTextBoxExtender ID="ftbe" runat="server"
            TargetControlID="txtスコスListening"         
            FilterType="Custom, Numbers"/>
        
       
       
       
       </div>  
       <div class="detail-admin-row">
            <span class="detail-admin-label">スコス(writing) :</span>
            <asp:TextBox ID="txtスコスwriting" runat="server" Width="159px" ValidationGroup="detailForm" CssClass="Font_textbox validation enter" MaxLength="8"></asp:TextBox><span class="required-field"> </span>
       
       
        <asp:CustomValidator runat="server" ID="validate_txtスコスwriting_Custom"  ClientValidationFunction="CheckDiem"
      ErrorMessage="" ControlToValidate="txtスコスwriting" Display="None"    SetFocusOnError="false" >
        </asp:CustomValidator>
          <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender6"
        TargetControlID="validate_txtスコスwriting_Custom" HighlightCssClass = "invalid" Width="260px"
        CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png" />
        
        
        
         <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server"
            TargetControlID="txtスコスwriting"         
            FilterType="Custom, Numbers"/>
       
       
       
       </div>
       <div class="detail-admin-row">
            <span class="detail-admin-label">スコス(reading) :</span>
            <asp:TextBox ID="txtスコスreading" runat="server" Width="159px" ValidationGroup="detailForm" CssClass="Font_textbox validation enter" MaxLength="8"></asp:TextBox><span class="required-field"> </span>
       
       
       
        <asp:CustomValidator runat="server" ID="validate_txtスコスreading"  ClientValidationFunction="CheckDiem"
      ErrorMessage="" ControlToValidate="txtスコスreading" Display="None"    SetFocusOnError="false" >
        </asp:CustomValidator>
          <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender7"
        TargetControlID="validate_txtスコスreading" HighlightCssClass = "invalid" Width="260px"
        CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png" />
       
        <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server"
            TargetControlID="txtスコスreading"         
            FilterType="Custom, Numbers"/>
       
       
       
       </div>          
      <%-- <div class="detail-admin-row">
            <span class="detail-admin-label">スコス(total) :</span>
            <asp:TextBox ID="txtスコスtotal" runat="server" BackColor="#E0E0E0" Width="92px"></asp:TextBox><span class="required-field"> </span>
       </div> --%>
       
         <%--<div style="display: none;">
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1"
                            ControlToValidate="TextBox1"
                            Display="None"
                            ErrorMessage="TextBox1: display none." />
            </div> --%>   
   <div class="detail-admin-row">
            <span class="detail-admin-label">&nbsp;</span>
             <asp:Button ID="btn_登録" runat="server" Text="登録" CssClass="btn" OnClientClick="javascript:focusToControlErr();"
                OnClick="btn_登録_Click" />
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
             <asp:Button ID="btn_リセット" runat="server" Text="リセット"  CssClass="btn" ValidationGroup="detail"
                 OnClick="btn_リセット_Click"/>
         </div>
</div>
         <div class="detail-admin-row">
             <div class="btn_back">
                <asp:Button ID="btn_戻る"  runat="server" Text="←戻る" OnClick="btn_戻る_Click" CssClass="btn" ValidationGroup="detail"/>
             </div>
             <div class="btn_next btn_next_fixedforfrmJ_StaffBasicInfoInput">
                 <asp:Button ID="btn_次"  runat="server" Text="次→" OnClick="btn_次_Click"  CssClass="btn" ValidationGroup="detail" />
             </div>
         </div>
    
  <div style="height:100px">&nbsp;</div>
  <br />  
</asp:Content>

